package model.tokens;
import java.lang.reflect.Constructor;
import java.util.Stack;

import state.TabState;

import model.expression.AbstractExpression;
import model.expression.constant.ConstantExpression;
import model.parser.ParserException;
import model.parser.ParsingData;


import expression.*;

/**
 * model.tokens that has a value and doesn't operate 
 * 
 * @author KevinWang Chris James Misha Lavrov
 *
 * @param <T>
 */
public class ConstantToken extends AbstractToken 
{
    protected int myValue;
    
    public ConstantToken(String value, ParsingData parsingData)
    {
        try
        {
        	myValue = Integer.parseInt(value);
        }
        catch (Exception e)
        {
		     //TODO do with exception
        }
    }

	//done Via shunting yard
    public void convertToPostFix(Stack<AbstractToken> opStack,
			Stack<AbstractExpression> outStack,TabState ts,Stack<AbstractExpression> out) 
	{
		outStack.push(new ConstantExpression(myValue));
	}
}
